const crypto = require("crypto");

module.exports = {
    "secretKey": "lovo",
    "algorithms": ["HS256"],
    "unless": {
        path: [
            "/admin/login",
            "/admin/reg",
            "/shops/all",
            "/users",
            "/users/:id",
            "/goods",  // 商品查询
            "/addresses/", // 地址增加
            "/addresses/id",  // 地址修改
            "/addresses/all",  // 地址查询
            "/orderGoods/",  // 增加商品订单
            "/orderGoods/putId",  // 修改商品订单
            "/orderGoods/all",  // 查询商品订单
        ]
    }
}

module.exports.sha256 = function (str) {
    let sha = crypto.createHash("sha256");
    return sha.update(str).digest("hex");
}